package 继承.父类成员访问.子类中访问父类的成员变量.子类和父类不存在同名成员变量;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 姚东名
 * Date: 2024-06-16
 * Time: 14:45
 */
public class Derived extends Base {
    int c;
    public void method() {
        this.a = 10;//访问从父类中继承下来的a
        this.b = 20;//访问从父类继中承下来的b
        this.c = 30;//访问子类自己的c
    }

    public static void main(String[] args) {
        Derived derived = new Derived();
        derived.method();
        System.out.println(derived.a);
    }
}
